#include "widget.h"
#include "ui_widget.h"
#include <QPainter>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
}

void Widget::paintEvent(QPaintEvent *event)
{
    (void)event;
    QPainter painter(this);
    painter.translate(150,200);
    QFont font("正楷", 20, QFont::Bold);
    painter.setFont(font);
    painter.drawText(0,100,"悟已往之不谏，知来者之可追!");
    //初次绘制总结
    //1.创建QPainter的时候忘记进行绑定this指针
    //2.创建了QFont对象，但忘记设置到painter当中
}

Widget::~Widget()
{
    delete ui;
}

